/**
 * Created by sunguodong on 2021/12/30.
 * Email: sungd@tongtech.com
 * Description: ArGIS 地图中的应用方法
*/

import './index.less';
import React, {useEffect} from "react";
import * as esriLoader from 'esri-loader';
const options = {   
    url: 'https://js.arcgis.com/3.39/',
}
esriLoader.loadScript(options);

export const MapMaxLevel: React.FC = () => {
    function componentDid() {
		esriLoader.loadModules([
			'esri/map',
		]).then(([Map, webMercatorUtils]) => {
			const map = new Map('mapCon', {
				basemap: 'topo-vector',
				center: [-122.45, 37.75],
				zoom: 5,
				maxZoom:19,//最大空间等级
    			minZoom:5,//最小空间等级
				logo: false, // 不显示esri的logo
			});
		}).catch(err => {
			console.error(err)
		})
	}

	useEffect(() => {
		return componentDid();
	}, []);

	function componentWillUn() {

	}

	useEffect(() => () => {
		return componentWillUn();
	}, []);

  	return (
		<div>
			<div id="mapCon"></div>
		</div>
	)
}
